//输入一个数组，随机打乱数组后输出
//夏梓豪
//2023/03/31

package code_jiaohuanshuzuzhongdeshuju;

import java.util.Random;

public class test2 {
    public static void main(String[] args) {
        int[] arr = {1,2,3,4,5};
        Random r = new Random();
        for (int i = 0,j = arr.length-1; i < j ; i++,j--) {
            int RandomIndex = r.nextInt(arr.length);
            int temp = arr[i];
            arr[i] = arr[RandomIndex];
            arr[RandomIndex] = temp;
        }


        for (int n = 0; n < arr.length; n++) {
            System.out.print(arr[n]+"\t");
        }
    }
}
